﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using com.vs.DataAccess;
using com.vs.DataAccess.DO;
using com.vs.General;
using com.vs.General.RF;

namespace com.vs.RF.Web.receiving
{
    public class AttributeEntryHandling :RFHandlingPage
    {
        private string[] arAttr = new string[8];

        protected void Page_Load(object sender, EventArgs e)
        {
            stSourcePage = "receiving/AttributeEntry.aspx";
            stTargetPage = "receiving/LPNEntry.aspx";
            go();
        }

        protected override void parseRequest()
        {
            arAttr[0] = Request["tbAttr0"];
            arAttr[1] = Request["tbAttr1"];
            arAttr[2] = Request["tbAttr2"];
            arAttr[3] = Request["tbAttr3"];
            arAttr[4] = Request["tbAttr4"];
            arAttr[5] = Request["tbAttr5"];
            arAttr[6] = Request["tbAttr6"];
            arAttr[7] = Request["tbAttr7"];
        }

        protected override void procData()
        {
            ReceiptContainerDO rcDO = null;
            ReceivingPreferenceDO prefDO = null;

            try
            {
                rcDO = (ReceiptContainerDO)Session["RECEIPT_CONTAINER_DO"];
                rcDO.ATTRIBUTE1 = arAttr[0];
                rcDO.ATTRIBUTE2 = arAttr[1];
                rcDO.ATTRIBUTE3 = arAttr[2];
                rcDO.ATTRIBUTE4 = arAttr[3];
                rcDO.ATTRIBUTE5 = arAttr[4];
                rcDO.ATTRIBUTE6 = arAttr[5];
                rcDO.ATTRIBUTE7 = arAttr[6];
                rcDO.ATTRIBUTE8 = arAttr[7];

                Session[RFSupport.RECEIPT_CONTAINER_DO] = rcDO;

                prefDO = (ReceivingPreferenceDO)Session[RFSupport.RECEIVING_PREFERENCE_DO];
                if (StringManager.Equals(prefDO.AUTO_ASSIGN_LPN, "Y"))
                    stTargetPage = "LPNEntryHandling.aspx";
            }
            catch (Exception ex)
            {
                ExceptionManager.LogException(rfSess, ex);
                stError = ex.Message;
            }
        }
    }
}
